<include file="Public:_header" />
<link rel="stylesheet" href="weixin_statics/css/easydropdown.metro.css">
<style>.hidd{display:none;}</style>
    <script language="javascript">
       function del(val){
        
            $.post("__URL__/del_exper", { "info_id": val},
               function(data){
                if (data.status==1) {
                  location.replace(location.href);  }
               }, "json");
       }
       
       
        function add() {
            $("#template").removeClass('hidd');
        }
        function quxiao() {
            $("#template").addClass('hidd');
        }

        function submit() {
            var flag=true;
            $("#content .gzlist").each(function(index){
                var that=this;
                if($(this).find(".start select").eq(0).val()==0||$(this).find(".start select").eq(1).val()==0||$(this).find(".end select").eq(0).val()==0||$(this).find(".end select").eq(1).val()==0)
                {
                    $(this).find(".error").html("请选择起止年月");
                    $(this).find(".error").show();
                    flag=false;
                }

                if($(this).find(".start select").eq(0).val()>$(this).find(".end select").eq(0).val()&&$(this).find(".start select").eq(1).val()>$(this).find(".end select").eq(1).val())
                {
                    $(this).find(".error").html("起止年月选择错误");
                    $(this).find(".error").show();
                    flag=false;
                }
                $(this).find("select").focus(function(){
                    $(that).find(".error").hide();
                });
            });
            
            if($("input[name='from[band][]']").attr('value')=="")
            {$(".band").removeClass('hidden');
                flag=false;
            }else{
                $(".band").addClass('hidden');
                flag = true;
            }
            if($("input[name='from[position][]']").attr('value')=="")
            {
                $(".position").removeClass('hidden');
                flag=false;
            }else{
                $(".position").addClass('hidden');
                flag = true;
            }
           if(flag==true)
           {
               $("form").submit();
           }
 
        }
        function initYearMonth(select)
        {
            var date = new Date();//实例化一个日期对象
            var year = date.getFullYear();//获取当前年份
            var month = date.getMonth()+1;//获取当前月份
            var day = date.getDate();//获取当前日

            var start_year=1990;
            var start_month=1;
            $(select+" [class='year']").append("<option value='0'>请选择年</option>");
             $(select+" [class='endyear']").append("<option value='0'>请选择年</option>");
             for(var i=year;i>=start_year;i--)
            {
                $(select+" [class='year']").append( "<option value='"+(i)+"'>"+(i)+"年</option>");
                 $(select+" [class='endyear']").append( "<option value='"+(i)+"'>"+(i)+"年</option>");
            }
            $(select+" [class='month']").append("<option value='0'>请选择月</option>");
            $(select+" [class='endmonth']").append("<option value='0'>请选择月</option>");
            for(var j=1;j<=12;j++)
            {
                $(select +" [class='month']").append( "<option value='"+(j)+"'>"+(j)+"月</option>");
                $(select +" [class='endmonth']").append( "<option value='"+(j)+"'>"+(j)+"月</option>");
            }
        }
        $(document).ready(function () {
                    initYearMonth("#template .start");
                    initYearMonth("#template .end");

                    $("[name='band']").live("focus",function(){
                        $(this).removeClass("red");
                    });
                    $("[name='band']").live("blur",function(){
                        if($.trim($(this).val()).length==0||$.trim($(this).val()).length>100)
                        {
                            $(this).addClass("red");
                        }
                    });

                    $("[name='position']").live("focus",function(){
                        $(this).removeClass("red");
                    });
                    $("[name='position']").live("blur",function(){
                        if($.trim($(this).val()).length==0||$.trim($(this).val()).length>100)
                        {
                            $(this).addClass("red");
                        }
                    });

                }
        );
    </script>

    <div class="warp">
        <h2 class="ztitle">工作经历</h2>
        <a class="submit add" href="javascript:add()" style="margin:0px;">增加一段经历</a>
    </div>
    <div class="warp" style="margin-top:20px;">
        <volist name="exper" id="eo">
        <h4>起止时间：{$eo.jobbegin} 至 {$eo.jobend} &nbsp; &nbsp; &nbsp;
            <a href="__ROOT__/weixin.php?s=/Resume/edit_exper_info/id/{$eo.in_id}">修改</a> | <a href="javascript:void(0);" class="del"  onClick="del({$eo.in_id})">删除</a></h4>
        <h5>所在公司或品牌：{$eo.jobname}</h5>
        <h5>所在职位：{$eo.jobzhiwei}</h5>
        <hr/>
        </volist>
    </div>
<form method="post" action="__URL__/add_exper">
<div id="template" class="hidd" name="template" style="margin:10px;">
<ul class="zllist gzlist"  >
    <li>起止时间</li>
    <li><span name="start" class="start"><select name="from[year][]" class="year">
    </select>&nbsp;<select name="from[month][]" class="month">

    </select> </span>&nbsp;到&nbsp;<span name="end" class="end"> <select name="from[endyear][]" class="endyear">

    </select>&nbsp;<select name="from[endmonth][]" class="endmonth">

    </select>&nbsp;</span><span class="error" style="color: red;display: none; padding-left: 10px;"></span></li>
    <li>所在公司和品牌 <span class="band hidden"><font color="red">请填写完整！</font></span></li>
    <li><input type="" class="text" name="from[band][]"/></li>
    <li>任职岗位 <span class="position hidden"><font color="red">请填写完整！</font></span></li>
    <li><input type="" class="text" name="from[position][]"/></li>
    <a class="submit" href="javascript:submit()">保存</a>
    <a class="submit add" href="javascript:quxiao()">取消</a>
</ul>
</div>
</form>
<a class="submit add" href="__ROOT__/weixin.php?s=/Resume/resume_01/edit/1" style="width:200px;">修改基本信息</a>
<a class="submit add" href="__ROOT__/weixin.php?s=/Resume/resume_02/edit/1" style="width:200px;">修改求职意向和工作年限</a>
<a class="submit add" href="__ROOT__/weixin.php?s=/Resume/resume_04/edit/1" style="width:200px;">修改自我介绍</a>
<script src="weixin_statics/js/jquery.easydropdown.js" type="text/javascript"></script>
<include file="./weixin/Tpl/default/public/_bottom.html" />